@startuml
namespace k8s {
    interface Client  {
        + AppsV1() v1.AppsV1Interface
        + CoreV1() v1.CoreV1Interface
        + NetworkingV1() v1.NetworkingV1Interface

    }
    class DescribableResource << (S,Aquamarine) >> {
        - object runtime.Object
        - accessor v1.Object

        + Resource() runtime.Object
        + Kind() Kind
        + Name() string
        + Namespace() string
        + IsKind(kind Kind) bool
        + Identity() DescribableResourceIdentity

    }
    class DescribableResources << (S,Aquamarine) >> {
        + Indexed() IndexedDescribableResources

    }
    class IndexedDescribableResources << (S,Aquamarine) >> {
        + RemoveResource(resource *DescribableResource) *DescribableResource

    }
    interface KindVisitor  {
        - visitNamespace( context.Context) error
        - visitDeployment( context.Context) error
        - visitNetworkPolicy( context.Context) error
        - visitService( context.Context) error
        - visitSecret( context.Context) error
        - visitVolumeClaim( context.Context) error
        - visitResourceQuota( context.Context) error
        - visitLimitRange( context.Context) error

    }
    class Namespace << (S,Aquamarine) >> {
        + ID internal.Namespace

    }
    class Repository << (S,Aquamarine) >> {
        - log *zap.SugaredLogger
        - serializer *json.Serializer
        - client Client

        - convertToResourceIndex(describable DescribableResources) (*DescribableResource, error)

        + ListNotDeletedNamespaces(ctx context.Context) ([]Namespace, error)
        + ListNamespaces(ctx context.Context) ([]Namespace, error)
        + CreateResources(ctx context.Context, resources []runtime.Object) error
        + UpdateResources(ctx context.Context, namespace internal.Namespace, resources []runtime.Object) (bool, error)
        + DeleteNamespace(ctx context.Context, namespace internal.Namespace) error

    }
    interface Visitor  {
        - visitNamespace( context.Context,  *v1.Namespace) error
        - visitDeployment( context.Context,  *v1.Deployment) error
        - visitNetworkPolicy( context.Context,  *v1.NetworkPolicy) error
        - visitService( context.Context,  *v1.Service) error
        - visitSecret( context.Context,  *v1.Secret) error
        - visitVolumeClaim( context.Context,  *v1.PersistentVolumeClaim) error
        - visitResourceQuota( context.Context,  *v1.ResourceQuota) error
        - visitLimitRange( context.Context,  *v1.LimitRange) error

    }
    class creatingVisitor << (S,Aquamarine) >> {
        - client Client
        - namespace internal.Namespace

        - visitNamespace(ctx context.Context, namespace *v1.Namespace) error
        - visitDeployment(ctx context.Context, deployment *v1.Deployment) error
        - visitNetworkPolicy(ctx context.Context, policy *v1.NetworkPolicy) error
        - visitService(ctx context.Context, service *v1.Service) error
        - visitSecret(ctx context.Context, secret *v1.Secret) error
        - visitVolumeClaim(ctx context.Context, pvc *v1.PersistentVolumeClaim) error
        - visitResourceQuota(ctx context.Context, quota *v1.ResourceQuota) error
        - visitLimitRange(ctx context.Context, limitRange *v1.LimitRange) error

    }
    class deletingVisitor << (S,Aquamarine) >> {
        - client Client
        - namespace internal.Namespace

        - visitNamespace(ctx context.Context, namespace *v1.Namespace) error
        - visitDeployment(ctx context.Context, deployment *v1.Deployment) error
        - visitNetworkPolicy(ctx context.Context, policy *v1.NetworkPolicy) error
        - visitService(ctx context.Context, service *v1.Service) error
        - visitSecret(ctx context.Context, secret *v1.Secret) error
        - visitVolumeClaim(ctx context.Context, pvc *v1.PersistentVolumeClaim) error
        - visitResourceQuota(ctx context.Context, quota *v1.ResourceQuota) error
        - visitLimitRange(ctx context.Context, limitRange *v1.LimitRange) error

    }
    class getVisitor << (S,Aquamarine) >> {
        - resourceName string
        - resource *DescribableResource
        - client Client
        - namespace internal.Namespace

        - visitNamespace(ctx context.Context) error
        - visitDeployment(ctx context.Context) error
        - visitNetworkPolicy(ctx context.Context) error
        - visitService(ctx context.Context) error
        - visitSecret(ctx context.Context) error
        - visitVolumeClaim(ctx context.Context) error
        - visitResourceQuota(ctx context.Context) error
        - visitLimitRange(ctx context.Context) error

    }
    class k8s.DescribableResourceIdentity << (T, #FF7700) >>  {
    }
    class k8s.DescribableResources << (T, #FF7700) >>  {
    }
    class k8s.IndexedDescribableResources << (T, #FF7700) >>  {
    }
    class k8s.Kind << (T, #FF7700) >>  {
    }
    class listVisitor << (S,Aquamarine) >> {
        - client Client
        - namespace internal.Namespace
        - resources []*DescribableResource

        - visitNamespace(ctx context.Context) error
        - visitDeployment(ctx context.Context) error
        - visitNetworkPolicy(ctx context.Context) error
        - visitService(ctx context.Context) error
        - visitSecret(ctx context.Context) error
        - visitVolumeClaim(ctx context.Context) error
        - visitResourceQuota(ctx context.Context) error
        - visitLimitRange(ctx context.Context) error

    }
    class updatingVisitor << (S,Aquamarine) >> {
        - client Client
        - namespace internal.Namespace

        - visitNamespace(ctx context.Context, namespace *v1.Namespace) error
        - visitDeployment(ctx context.Context, deployment *v1.Deployment) error
        - visitNetworkPolicy(ctx context.Context, policy *v1.NetworkPolicy) error
        - visitService(ctx context.Context, service *v1.Service) error
        - visitSecret(ctx context.Context, secret *v1.Secret) error
        - visitVolumeClaim(ctx context.Context, pvc *v1.PersistentVolumeClaim) error
        - visitResourceQuota(ctx context.Context, quota *v1.ResourceQuota) error
        - visitLimitRange(ctx context.Context, limitRange *v1.LimitRange) error

    }
}

"k8s.Visitor" <|-- "k8s.creatingVisitor"
"k8s.Visitor" <|-- "k8s.deletingVisitor"
"k8s.KindVisitor" <|-- "k8s.getVisitor"
"k8s.KindVisitor" <|-- "k8s.listVisitor"
"k8s.Visitor" <|-- "k8s.updatingVisitor"

"__builtin__.string" #.. "k8s.DescribableResourceIdentity"
"__builtin__.string" #.. "k8s.Kind"
"k8s.<font color=blue>map</font>[DescribableResourceIdentity]*{packageName}DescribableResource" #.. "k8s.IndexedDescribableResources"
"k8s.[]*DescribableResource" #.. "k8s.DescribableResources"
@enduml
